<template>
    <div>
  <div class="commentInfo" v-if="Object.keys(commentInfo).length !==0">
      <div class="infoHeader">
          <div class="headerTitle">用户评价</div>
          <div class="headerMore">
              更多→
          </div>
      </div>
      <div class="infoUser">
          <img :src="commentInfo.user.avatar" alt="">
          <span>{{commentInfo.user.uname}} </span>
      </div>
      <div class="infoDetail">
          <p>{{commentInfo.content}} </p>
          <div class="infoOther">
              <span class="date">{{showDate(commentInfo.created)}} </span>
              <span>{{commentInfo.style}} </span>
          </div>
          <div class="infoImags">
              <img :src="item" alt="" v-for="(item,index) in commentInfo.images" :key='index'>
          </div>
      </div>
  </div>
  <div v-else class="no flex f-a a-c">
      暂无评论...
  </div>
  </div>
</template>

<script>
export default {
    name:'detailCommentInfo',
    props:{
        commentInfo:{
            type:Object
        }
    },
    methods:{
        showDate(val){
            
            let date=new Date(val*1000)
            let M= date.getMonth()
            let Y= date.getFullYear()
            let D= date.getDate()
            return Y+'-'+M+'-'+D
        }
    }
}
</script>

<style scoped>
    .commentInfo{
        padding: 5px 12px;
        color:#333;
        border-bottom: 5px solid #f2f5f8;
    }
    .infoHeader{
        height: 50px;
        line-height: 50px;
        border-bottom: 1px solid rgba(0,0,0,.1);
    }
    .headerTitle{
        float: left;
        font-size: 15px;
    }
    .headerMore{
        float: right;
        margin-right: 10px;
        font-size: 13px;
    }
    .infoUser{
        padding: 10px 0 5px;
    }
    .infoUser img{
        width: 42px;
        height: 42px;
        border-radius: 50%;
    }
    .infoUser span{
        position: relative;
        font-size: 15px;
        top: -15px;
        margin-left: 10px;
    }
    .infoDetail{
        padding: 0 5px 15px;
    }
    .infoDetail p{
        font-size: 14px;
        color: #777;
        line-height: 1.5;
    }
    .infoDetail .infoOther{
        font-size: 12px;
        color: #999;
        margin-top: 10px;
    }
    .infoOther .date{
        margin-right: 8px;
    }
    .infoImags{
        margin-top: 10px;
    }
    .infoImags img{
        width: 70px;
        height: 70px;
        margin-right: 5px;
    }
    .no{
        height: 80px;
        font-size: 21px;
        color:rgb(65, 51, 34);
        background-color: #eee;
        
    }
</style>